var tps =
{		
	fontsize:function(size)
	{
		$("#article").css("font-size",size + "px");
	},
	show:function(id)
	{
		$("#imgX").attr("src",$("#img_" + id).attr("src"));
	},
	addfav:function(url, title)
	{
		try
		{
			window.external.addFavorite(url, title);
		}
		catch (e)
		{
			try
			{
				window.sidebar.addPanel(title, url, "");
			}
			catch (e)
			{
				alert("加入收藏失败，请使用Ctrl+D进行添加");
			}
		}
	},	
	sendpost:function()
	{
		var u = $("#username");
		var t = $("#telphone");
		var a = $("#address");
		var q = $("#tencentq");
		var e = $("#email");
		var c = $("#content");
		var code = $("#chkcode");
		var msg = $("#showmsg");
		if(u.val().length <= 0)
		{
			u.html("请填写用户名");
			u.focus();
			return false;
		}
		if(t.val() <= 0)
		{
			t.html("请填写联系电话");
			t.focus();
			return false;
		}
		
		if(code.val() <= 0)
		{
			msg.html("请填写验证码");
			code.focus();
			return false;
		}
		return true;
	},
	sethome:function(obj,vrl)
	{
		try
		{
			obj.style.behavior='url(#default#homepage)';
			obj.setHomePage(vrl);
		}
		catch(e)
		{
			if(window.netscape) 
			{
				try 
				{
					netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
				}
				catch (e) 
				{
					alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将 [signed.applets.codebase_principal_support]设置为'true'");
				}
				var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
				prefs.setCharPref('browser.startup.homepage',vrl);
			 }
		}
	}
}
$(document).ready(function()
{
	var para = window.location.pathname;	
	var url = para.split("/")[1].split("/")[0];
	
	if(url == "")
		url = "/";
	else if(url == "item")
		url = "/item/about.html";
	else
	{
		if(url.lastIndexOf('.') > 0)
			url = "/" + url;
		else
			url = "/" + url + ".html";
	}
	$("#menu a").removeClass("fixed");
	$("#menu a[href='" + url + "']").addClass("fixed");
	if ($("#flashbox"))
	{
		$("#flashbox").slide({titCell:".hd a", mainCell: ".bd", effect: "fold",autoPlay:1, delayTime: 10000});
	}
	$("#gotop").click(function()
	{
		$("html,body").animate({'scrollTop':'0px'},500);
	});
	$("#hotkey").click(function()
	{
		key = $("#keyword");
		if(key.val().length <= 0)
		{
			alert("请填写搜索关键字");
			key.focus();
			return false;
		}
		location.href = "/search/s-" + key.val() + ".html";
	})
})